package com.android.common.utils.media.screen;


import android.app.Notification;
import android.content.Context;
import android.graphics.BitmapFactory;
import androidx.annotation.NonNull;
import androidx.core.app.NotificationCompat;
import com.android.common.R;
import com.android.common.constant.Constant;
import com.android.common.utils.AppUtils;


public class ScreenNotification {

    public static Notification createCaptureNotification(@NonNull Context context) {
        String title = context.getString(R.string.capturing_screen);
        String channelId = AppUtils.getAppMetaData(context, Constant.NOTIFICATION_CHANNEL_KEY);
        Notification notification = new NotificationCompat.Builder(context, channelId)
                .setContentTitle(context.getString(R.string.app_name))
                .setWhen(System.currentTimeMillis())
                .setSmallIcon(R.mipmap.camera)
                .setLargeIcon(BitmapFactory.decodeResource(context.getResources(), R.mipmap.camera))
                .setOngoing(true)// 常驻通知栏
                .setTicker(title)
                .setContentText(title)
                .setDefaults(Notification.DEFAULT_ALL)
                .build();
        return notification;
    }

    public static Notification createRecordNotification(@NonNull Context context) {
        String title = context.getString(R.string.recording_screen);
        String channelId = AppUtils.getAppMetaData(context, Constant.NOTIFICATION_CHANNEL_KEY);
        Notification notification = new NotificationCompat.Builder(context, channelId)
                .setContentTitle(context.getString(R.string.app_name))
                .setWhen(System.currentTimeMillis())
                .setSmallIcon(R.mipmap.video)
                .setLargeIcon(BitmapFactory.decodeResource(context.getResources(), R.mipmap.video))
                .setOngoing(true)// 常驻通知栏
                .setTicker(title)
                .setContentText(title)
                .setDefaults(Notification.DEFAULT_ALL)
                .build();
        return notification;
    }

}
